package server;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class PortListener implements Runnable{
  
  private final ServerSocket server_;
  
  /**
   * Constructs a main listener
   */
  public PortListener(ServerSocket server) {
    assert server != null;
    server_ = server;
  }

  public void run() {
    
    while (true) {
      try {
        Socket socket = server_.accept();
        new Thread(new LoginManager(socket)).start();
      } catch (IOException e) {
        System.out.println("failed");
        return;
      }
    }
    
  }
  
  
  
}
